/*
 * @Author: your name
 * @Date: 2021-11-13 15:40:01
 * @LastEditTime: 2021-11-16 08:28:27
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \li-yuwei\serve\app\controller\tagDb.js
 */
const Controller = require("../core/base_controller");
class TagController extends Controller {
    //获取标签
    async getTagList() {
            const { ctx } = this;
            try {
                const res = await ctx.service.tag.getTagList();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //获取标签个数
    async getTagTotal() {
            const { ctx } = this;
            try {
                const res = await ctx.service.tag.getTagTotal();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //添加标签
    async addTagList() {
            const { ctx } = this;
            try {
                const res = await ctx.service.tag.addTagList();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //删除标签
    async delTagList() {
            const { ctx } = this;
            try {
                const res = await ctx.service.tag.delTagList();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //更新
    async editTagList() {
            const { ctx } = this;
            try {
                const res = await ctx.service.tag.editTagList();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //    *****用户端***********************  //
        //获取标签 ---带数量
    async getClientTag() {
            const { ctx } = this;
            try {
                const res = await ctx.service.tag.getClientTag();
                this.success(res);
            } catch (err) {
                this.error(err.message);
            }
        }
        //获取标签文章
    async getTagArticle() {
        const { ctx } = this;
        try {
            const res = await ctx.service.tag.getTagArticle();
            this.success(res);
        } catch (err) {
            this.error(err.message);
        }
    }
}

module.exports = TagController;